﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SMath = System.Math;
namespace Hack.Misc.BodyCalculations
{
    /// <summary>
    /// Antibiotica calculations
    /// </summary>
    public static class Bsa
    {
        /// <summary>
        /// The doctor has ordered an antibiotic on 11 y/o Billy.   
        /// The average adult dose is 250 mg.  
        /// 
        /// Billy is 157.5 cm in height and weighs 45 kg.  
        /// BSA is then 1.41909 M'2
        /// </summary>
        /// <param name="weight_kg"></param>
        /// <param name="height_cm"></param>
        /// <returns></returns>
        public static BsaResult Calculate(double height_cm, double weight_kg)
        {
            return new BsaResult(
                height_cm,
                weight_kg,
                SMath.Pow(weight_kg, 0.425) *
                SMath.Pow(height_cm, 0.725) *
                0.007184
            );
        }

    }
    [Serializable]
    public class BsaResult
    {
        public BsaResult(double height_cm, double weight_kg, double bsa)
        {
            this.Height = height_cm;
            this.Weight = weight_kg;
            this.BSA = bsa;
        }
        public double Height { get; internal set; }
        public double Weight { get; internal set; }
        public double BSA { get; internal set; }

        public override string ToString()
        {
            return String.Format("Height: {0} Weight: {1} BSA: {2}",
                this.Height,
                this.Weight, 
                this.BSA
            );
        }
    }
}